package oop6;

import oop5.Cat;
import oop5.Pet;

/**
 * @author oldliu
 * @since 1.0
 */
public class PetTest7 {
    public static void main(String[] args) {
        Pet p = new Parrot("小翠");
        p.print();

        Parrot yingwu = (Parrot) p;//强转，向下转型
        // p.fly();
        yingwu.fly();
        System.out.println("------------------------");
        if (p instanceof Cat) {
            Cat c = (Cat) p;
            c.catchMouse("鼠琦");
        } else {
            System.out.println("p不是猫");
        }

    }
}
